package com.designMode.proxy.code;

public class ViewPointProxy implements ViewPoint {

    private final ViewPoint viewPoint;

    private static final int maxPiao = 3;

    private int numPiao;
    public ViewPointProxy(ViewPoint viewPoint) {
        this.viewPoint = viewPoint;
    }

    @Override
    public void enter(Person person) {
        if (numPiao < maxPiao) {
            viewPoint.enter(person);
            numPiao ++ ;
        }
        else {
            System.out.println("票已经卖光");
        }
    }
}
